<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
<head>
    <title></title>
    <meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/ligerui.ftl" />
    <script type="text/javascript">
        <!--
        var ligerTable = null;
        $(function(){
            $('.select-chosen').chosen();
            ligerTable = $('#table').ligerGrid({
                width:'98%',
                enabledSort:false,
                pageSizeOptions:[5,10,20,50,100,200],
                height:'auto',
                alternatingRow:true,
                url:'${base}/baseinfo/${route}/getList',
                delayLoad:false,
                columns:[
                    {display:'公司标识',name:'companyId',id:'companyId',align:'center',minWidth:80},
                    {display:'服务机构所在地的行政区划',name:'address',id:'address',align:'center',minWidth:80},
                    {display:'服务机构名称',name:'serviceName',id:'serviceName',align:'center',minWidth:80},
                    {display:'服务机构代码',name:'serviceNo',id:'serviceNo',align:'center',minWidth:80},
                    {display:'服务机构地址',name:'detailAddress',id:'detailAddress',align:'center',minWidth:80},
                    {display:'服务机构负责人姓名',name:'responsibleName',id:'responsibleName',align:'center',minWidth:80},
                    {display:'负责人联系电话',name:'responsiblePhone',id:'responsiblePhone',align:'center',minWidth:80},
                    {display:'服务机构管理人姓名',name:'managerName',id:'managerName',align:'center',minWidth:80},
                    {display:'管理人联系电话',name:'managerPhone',id:'managerPhone',align:'center',minWidth:80},
                    {display:'服务机构紧急联系电话',name:'contactPhone',id:'contactPhone',align:'center',minWidth:80},
                    {display:'行政文书送达邮寄地址',name:'mailAddress',id:'mailAddress',align:'center',minWidth:80},
                    {display:'服务机构设立日期',name:'createDate',id:'createDate',align:'center',minWidth:80},
                    {
                        display:'状态',
                        name:'state',
                        id:'state',
                        align:'center',
                        minWidth:80,
                        render:function(row){
                            if(row.state == 0){
                                return '有效';
                            } else if(row.state == 1){
                                return '失效';
                            }
                            return '';
                        }
                    },
                    {
                        display:'操作标识',
                        name:'flag',
                        id:'flag',
                        align:'center',
                        minWidth:80,
                        render:function(row){
                            if(row.flag == 1){
                                return '新增';
                            } else if(row.flag == 2){
                                return '更新';
                            } else if(row.flag == 3){
                                return '删除';
                            }
                            return '';
                        }
                    },
                    {display:'更新时间',name:'updateTime',id:'updateTime',align:'center',minWidth:120}
                ],
                onDblClickRow: function (data, rowindex, rowobj){
                    layer.open({
                        title:'${module}',
                        type:2,
                        maxmin:false,
                        area: ['100%', '100%'],
                        content:'${base}/baseinfo/${route}/view/'+data.id
                    });
                }
            });

            function reload(){
                if(ligerTable){
                    var ServiceName = $('#txtServiceName').val();
                    ligerTable.setParm('ServiceName',ServiceName);
                    ligerTable.reload();
                }
            }
            $('#btnSearch').click(function(){
                reload();
            })
            $('#btnEdit').click(function(){
                if(ligerTable){
                    var row = ligerTable.getSelectedRow();
                    if(!row || row.helpId < 1){
                        layer.msg('请选择行')
                        return;
                    }
                    var id = row.id;
                    var url='${base}/baseinfo/${route}/edit/'+id;
                    changePage(url);
                }
            });
            $('#btnRemove').click(function(){
                if(ligerTable){
                    var row = ligerTable.getSelectedRow();
                    if(!row || row.helpId < 1){
                        layer.msg('请选择行')
                        return;
                    }
                    var id = row.id;
                    layer.confirm('确定要删除吗？',function(){
                        $.ajax({
                            url:'${base}/baseinfo/${route}/remove/'+id,
                            type:'POST',
                            data:{},
                            dataType:'json',
                            success:function(rst){
                                layer.alert(rst.message);
                                if(rst.status=='OK' && ligerTable != null ){
                                    ligerTable.reload();
                                }
                            }
                        });
                    });
                }
            });
        });
        //-->
    </script>
</head>
<body class="$configs["skinName"]">
		<#include "common/breadcrumb.ftl">
<div class="widget-box">
    <div class="widget-header widget-header-flat">
        <h5 class="lighter">
            <i class="fa fa-search"></i>
            服务机构信息查询
        </h5>
    </div>
    <div class="widget-body">
        <div class="widget-main">
            <div class="row">
                <div class="col-xs-5 col-sm-5">
                    <div class="input-group">
                        <span class="input-group-addon">关键字</span>
                        <input id="txtServiceName" type="text" class="form-control search-query" placeholder="请输入关键字搜索" />
                        <span class="input-group-btn">
									<button id="btnSearch" type="button" class="btn btn-primary btn-sm">
										查询
										<i class="fa fa-search bigger-110"></i>
									</button>
								</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="widget-box">
    <div class="widget-header">
        <h5 class="lighter">
            <i class="icon-table"></i>
            服务机构信息列表
        </h5>
        <!--非查询者有该操作-->
				<#if user?exists && viewerRole?exists && user.roleId != viewerRole>
				<div class="widget-toolbar">
                    <button id="btnEdit" type="button" class="btn btn-primary btn-xs">
                        <i class="fa fa-check-square-o"></i>编辑
                    </button>
                    <button id="btnRemove" type="button" class="btn btn-primary btn-xs">
                        <i class="fa fa-trash-o"></i>删除
                    </button>
                </div>
                </#if>
    </div>
    <div class="widget-body">
        <div id="table"><div>
        </div>
        </div>
        </body>
</html>